package fgoScript;

import com.sun.jna.Library;
import com.sun.jna.Native;
import commons.util.GameUtil;
import fgoScript.exception.AppNeedStopException;

import java.awt.*;

public class test {
    public static void main(String[] args) {
        System.out.println("���Կ�ʼ");

        DD.INSTANCE.DD_btn(0);//to add a line

//        DD.INSTANCE.DD_mov(500, 500);
//        DD.INSTANCE.DD_movR(100, 100);
//        //DD.INSTANCE.DD_btn(4);DD.INSTANCE.DD_btn(8); //
//        GameUtil.delay(1000);
//        DD.INSTANCE.DD_movR(100, 100);
//        GameUtil.delay(1000);
//        DD.INSTANCE.DD_movR(100, 100);
//        GameUtil.delay(1000);
//        DD.INSTANCE.DD_movR(100, 100);
        try {
            GameUtil.getMymouse().mouseMoveByPoint(new Point(422, 83), false, false);
            GameUtil.delay(1000);
            GameUtil.getMymouse().mouseMoveByPoint(new Point(622, 83), false, false);
            GameUtil.delay(1000);
            GameUtil.getMymouse().mouseMoveByPoint(new Point(422, 83), false, false);
            GameUtil.delay(1000);
            GameUtil.getMymouse().mouseMoveByPoint(new Point(622, 83), false, false);
            GameUtil.delay(1000);
        } catch (AppNeedStopException e) {
            e.printStackTrace();
        }

//        DD.INSTANCE.DD_key(601, 1); // 1==down, 601=Left.Win (dd key code)
//        DD.INSTANCE.DD_key(601, 2); // 2=up
//        DD.INSTANCE.DD_str("123@AbC");
    }


    public interface DD extends Library {
        DD INSTANCE = (DD) Native.loadLibrary("dd43390.dll", DD.class);

        public int DD_mov(int x, int y);//mouse move abs.

        public int DD_movR(int dx, int dy);//mouse move rel.

        public int DD_btn(int btn);//1==L.down, 2==L.up, 4==R.down, 8==R.up, 16==M.down, 32==M.up

        public int DD_whl(int whl);//Mouse Wheel. 1==down, 2==up

        public int DD_key(int ddcode, int flag);//keyboard,

        public int DD_str(String s);////Input visible char
    }
}
